cmake_minimum_required(VERSION 3.5)
project(aloam_ros2)

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-std=c++14")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")

if (POLICY CMP0074)
  cmake_policy(SET CMP0074 NEW)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(image_transport REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(pcl_conversions REQUIRED)

find_package(Eigen3 REQUIRED)
find_package(PCL REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Ceres REQUIRED)

include_directories(
  include
	${PCL_INCLUDE_DIRS}
  ${CERES_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  ${pcl_conversions_INCLUDE_DIRS}
  )




add_executable(ascanRegistration src/scanRegistration.cpp src/pclDeskewing.cpp)
ament_target_dependencies(ascanRegistration rclcpp geometry_msgs nav_msgs sensor_msgs std_msgs image_transport cv_bridge tf2_ros pcl_conversions)
target_link_libraries(ascanRegistration ${PCL_LIBRARIES})

add_executable(alaserOdometry src/laserOdometry.cpp)
ament_target_dependencies(alaserOdometry rclcpp geometry_msgs nav_msgs sensor_msgs std_msgs image_transport cv_bridge tf2_ros)
target_link_libraries(alaserOdometry  ${PCL_LIBRARIES} ${CERES_LIBRARIES})

add_executable(alaserMapping src/laserMapping.cpp)
ament_target_dependencies(alaserMapping rclcpp geometry_msgs nav_msgs sensor_msgs std_msgs image_transport cv_bridge tf2_ros pcl_conversions)
target_link_libraries(alaserMapping  ${PCL_LIBRARIES} ${CERES_LIBRARIES})

add_executable(kittiHelper src/kittiHelper.cpp)
ament_target_dependencies(kittiHelper rclcpp geometry_msgs nav_msgs sensor_msgs std_msgs image_transport cv_bridge tf2_ros pcl_conversions)
target_link_libraries(kittiHelper  ${PCL_LIBRARIES} ${OpenCV_LIBS})

install(
  TARGETS ascanRegistration alaserMapping alaserOdometry kittiHelper
  DESTINATION lib/${PROJECT_NAME}
)

install(
  DIRECTORY launch
  DESTINATION share/${PROJECT_NAME}
)

install(
  DIRECTORY rviz_cfg
  DESTINATION share/${PROJECT_NAME}
)

ament_package()

